package chapter23.homework02;

public abstract class State {
    protected String rankName;//玩家姓名
    protected int point;//积分
    protected Player player;

    public String getRankName() {
        return rankName;
    }

    public void setRankName(String rankName) {
        this.rankName = rankName;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }

    public void playLose(){
        point -= 10;//失败减少积分
        checkState(point);//检查当前的积分所在的范围
        System.out.println(rankName + "玩家" + player.getName() + "输了，积分减少10," + point);

    }

    public void playWin(){//玩家成功加分
        point += 20;
        checkState(point);//检查当前的积分所在的范围
        System.out.println(rankName + "玩家" + player.getName() + "胜利，积分增加20," + point);
    }

    public void doubleScore(){//达到熟练积分加倍
        System.out.println(rankName + "积分加倍...");
    }

    public void changeCards(){//达到高手（在积分加倍的基础上）再次增加换牌功能
        System.out.println(rankName + "增加换牌的功能...");
    }

    public void peekCard(){//达到骨灰级（在高手基础上）可以再次增加偷看他人牌的功能
        System.out.println(rankName + "增加偷看他人的功能...");
    }
    public abstract void checkState(int point);
}
